package kr.hkit.powerjava.homework;

import java.util.Scanner;

public class Histo {

	private static int[] histo;
	public static int[] num;
	Scanner sc;

	public Histo(int nnum) {
		num = new int[nnum];
		histo = new int[10];
	}

	private static void numin() {
		Scanner sc = new Scanner(System.in);

		for (int i = 0; i < num.length; i++) {
			System.out.println("숫자 입력 1~100사이:");
			num[i] = sc.nextInt();
		}
	}

	private static void histogram() {
		// TODO Auto-generated method stub
		for (int i = 0; i < num.length; i++) {
			if (num[i] % 10 == 0) {
				histo[(num[i] / 10) - 1]++;
			} else {
				histo[(int) (num[i] / 10)]++;
			}
		}
	}

	private static void histogramp() {
		// TODO Auto-generated method stub
		for (int i = 0; i < num.length; i++) {

			System.out.printf("%d ~ %d :", (i * 10) + 1, (i + 1) * 10);
			for (int j = 0; j < histo[i]; j++) {
				System.out.printf("*");

			}
			System.out.println();
		}
	}

	public static void main(String[] args) {
		Histo his = new Histo(10);
		his.numin();
		his.histogram();
		his.histogramp();
	}
}
